C# - Open default mail client or run Outlook

chris (2005-01-10 13:33:15)
11103 views
1 replies
You might need your Windows Forms application to automatically load the default email client, or to load an email program as a result of an event occuring. To do so is quite easy, but don't fall into the trap of just running OUTLOOK.exe, because many people don't have Outlook registered as their default email client. Other popular mail clients include Eudora, Thunderbird and Outlook Express.

The eassy solution here is just to call the static Start method, passing in a mailto:user@address.com string. You can try this straight away by clicking on Start -> Run and then type in "mailto:fred@something.com" (without the quotes). You will see Windows load your default email program.

To achieve the same result in C#, just call System.Diagnostics.Process.Start("mailto:chris@enovi.com");


It's as simple as that.


christo


comment
Halil
2010-03-08 10:46:05

It's not very simple when you try to attach file.
You might need your Windows Forms application to automatically load the default email client, or to load an email program as a result of an event occuring. To do so is quite easy, but don't fall into the trap of just running OUTLOOK.exe, because many people don't have Outlook registered as their default email client. Other popular mail clients include Eudora, Thunderbird and Outlook Express.

The eassy solution here is just to call the static Start method, passing in a mailto:user@address.com string. You can try this straight away by clicking on Start -> Run and then type in "mailto:fred@something.com" (without the quotes). You will see Windows load your default email program.

To achieve the same result in C#, just call System.Diagnostics.Process.Start("mailto:chris@enovi.com");


It's as simple as that.


christo


reply iconedit reply